package com.ai.entity.function;

import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FunctionVO implements Serializable {

    @ApiModelProperty(value = "主键,主键ID")
    private Integer id;

    /**
     * 代号（备用主键）
     */
    @ApiModelProperty(value = "代号")
    private String code;

    /**
     * 功能名称
     */
    @ApiModelProperty(value = "功能名称")
    private String nickname;

    /**
     * 默认坐标点
     */
    @Deprecated
    @ApiModelProperty(value = "默认坐标点")
    private String spot;

    /**
     * 默认坐标点
     */
    @Deprecated
    @ApiModelProperty(value = "默认坐标点")
    private JSONArray spots;

    /**
     * 功能值
     */
    @ApiModelProperty(value = "功能值")
    private Integer type;

    /**
     * 区域数量
     */
    @Deprecated
    @ApiModelProperty(value = "区域数量")
    private Integer num;

    /**
     * 选中状态
     */
    @Deprecated
    @ApiModelProperty(value = "状态(1.选中，2.未选中)")
    private Integer state;

    /**
     * 阈值
     */
    @Deprecated
    private Integer threshold;

    public void addNum() {
        num++;
    }

    public static FunctionVO convertPOToVO(FunctionPO functionPO) {
        FunctionVO functionVO = new FunctionVO();
        BeanUtils.copyProperties(functionPO, functionVO);
        return functionVO;
    }
}
